package niuke;

/**
 * @author wangmaolin1
 * @date 2022/7/30 10:45 上午
 */
public class _140排序 {

    public static int[] MySort (int[] arr) {
        // write code here
        for (int i = 0; i < arr.length; i++) {
            for (int j = i+1; j <arr.length; j++) {
                if (arr[j]<arr[i]){
                    swap(arr,i,j);
                }
            }
        }
        return arr;
    }

    public static void swap(int []arr,int i,int j){
        int temp=arr[i];
        arr[i]=arr[j];
        arr[j]=temp;
    }


    public static void main(String[] args) {
        int []arr=new int[]{1,2};
//        int []arr=new int[]{5,3,2,56,76,89,12,1};
        MySort(arr);
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
}
